package com.springboot.springmvc.restful.crud.validator;

import com.springboot.springmvc.restful.crud.annotation.Gender;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;

public class GenderValidator implements ConstraintValidator<Gender,String> {
    //value = 前端提交的，要求校验的属性值
    @Override
    public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) {
        return "男".equals(value) || "女".equals(value);
    }
}
